package com.hzhr.iot.web.controller.base;

import com.hzhr.iot.login.sdk.model.userCard.UserCardModel;
import com.hzhr.iot.login.sdk.service.Login_UserCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;

import javax.servlet.http.HttpServletRequest;


public class BaseController {
	@Autowired
	HttpServletRequest request;

	@Autowired
	Login_UserCardService login_userCardService;

	protected UserCardModel getUserCard(String token) throws Exception {
		if (StringUtils.isEmpty(token)) return null;
		UserCardModel userCard = login_userCardService.getUserCard(null, token, null).getModel();
		return userCard;
	}

	protected String getToken() {
		String token = request.getParameter("uat");
		return token;
	}
}
